package cn.jy.feeback.controller;

import cn.jy.common.feeback.ExpressFeeback;
import cn.jy.common.feeback.ExpressFeebackVo;
import cn.jy.feeback.mapper.ExpressFeebackMapper;
import cn.jy.feeback.mapper.ExpressListMapper;
import cn.jy.feeback.service.ExpressFeebackService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/feeback")
@CrossOrigin
public class ExpressFeebackController {

    @Autowired
    private ExpressFeebackService expressFeebackService;
    @Autowired
    private ExpressListMapper expressListMapper;
    @Autowired
    private ExpressFeebackMapper expressfeebackmapper;

    @GetMapping("/list")
    public PageInfo<ExpressFeebackVo> selectExpressFeebackList(ExpressFeebackVo expressFeebackVo){
        return expressFeebackService.selectExpressFeebackList(expressFeebackVo);
    }

    @GetMapping("/selectExpressName")
    public String selectExpressName(@RequestParam("registerIp") String registerIp){
        return expressListMapper.selectExpressList(registerIp);
    }

    @GetMapping("/findId")
    public ExpressFeeback findId(@RequestParam("id") Integer id){
        return expressFeebackService.findId(id);
    }


    @PostMapping("/updateExpressFeeback")
    public int updateExpressFeeback(@RequestBody ExpressFeeback expressFeeback){
        return expressFeebackService.updateExpressFeeback(expressFeeback);
    }
    @PostMapping("/updateExpressFeeback2")
    public int updateExpressFeeback2(@RequestBody ExpressFeeback expressFeeback){
        return expressfeebackmapper.updateExpressFeeback2(expressFeeback);
    }
}
